for Module in Folder do

Hi guys,

As the DXL Help says the 'for Module in Folder do'-loop provides access to all open modules in a folder.

Is there a way to find all modules, not only the opened?

Regards,
Manuel
ManuelFelger - Fri Aug 28 09:30:48 EDT 2009

Re: for Module in Folder do
SystemAdmin - Fri Aug 28 09:41:04 EDT 2009

Look in this discussion

http://www.ibm.com/developerworks/forums/thread.jspa?threadID=274538&tstart=0

Re: for Module in Folder do
ManuelFelger - Fri Aug 28 09:53:32 EDT 2009

SystemAdmin - Fri Aug 28 09:41:04 EDT 2009
Look in this discussion

http://www.ibm.com/developerworks/forums/thread.jspa?threadID=274538&tstart=0

Thanks a bunch!

Regards,
Manuel

Re: for Module in Folder do
llandale - Fri Aug 28 10:10:14 EDT 2009

The "for item in folder/project" loops provide closed modules in their create (item) order. Usually you'd prefer them in alpha order. If you want things processed in GUI displayed order, you'd do something like this:

void  RecurseFolder(Folder fld)
{   // Deal RECURSIVELY with sub-folders, and then all modules in this folder
 
    Skip skpItems = createString()
    Item itm
    string NameItem
    Folder fldNew
                  // Stage in Skip, key is name which is Alpha order
    for itm in fld do
    {  put (skpItems, fullName(itm), itm)
    }
                 // Recurse through sub-folders
    for itm in skpItems do
    {  if (type(itm) == "Folder" or type(itm) == "Project")
       {  NameItem = (string key skpItems)
          fldNew = folder(NameItem)
          RecurseFolder(fldNew)   // *** RECURSION ***
       }
    }
                // Now deal with modules in THIS folder
    for itm in skpItems do
    {  NameItem = (string key skpItems)
       if    (type(itm) == "Formal")      DealWithFormalModule(NameItem)
       elseif(type(itm) == "Descriptive") DealWithDescriptiveModule(NameItem)
       elseif(type(itm) == "Link")        DealWithLinkModule(NameItem)
       else{}   // Ignore Folder/Project
    }
    delete(skpItems)
} // end RecurseFolder()
 
Folder fCurr = current
if     (!null project(fullName(fCurr))  // Folder IS a project; no need to prompt
     RecurseFolder(fCurr)
elseif (confirm("[Confirm] to do current Folder;\n[Cancel] to do current Project"))
     RecurseFolder(fCurr)
else RecurseFolder(folder(fullName(getParentProject(fCurr)))


Yes, do more checking at the bottom. Yes, I usually deal with modules before the sub-folders.

 

 

  • Louie